package com.utils;

import android.graphics.Color;

public class TraceLine {
	private final float startX;
	private final float startY;
	private final float endX;
	private final float endY;
	private byte red;
	private byte green;
	private byte blue;
	private byte alpha;
	private byte alphaDec = 1;
	private float thickness = 20;
	private final float thickDec = 0.1f;
	
	public TraceLine(float x, float y, float lastX, float lastY)
	{
		this.startX = x;
		this.startY = y;
		this.endX = lastX;
		this.endY = lastY;
		randomize();
		alpha = Byte.MAX_VALUE;
	}

	public float getStartX() {
		return startX;
	}

	public float getStartY() {
		return startY;
	}

	public float getEndX() {
		return endX;
	}

	public float getEndY() {
		return endY;
	}

	public int getColor() {
		return Color.argb(alpha, red, green, blue);
	}
	
	public float getThickness()
	{
		return thickness;
	}
	
	public boolean fade()
	{
		alpha -= alphaDec;
		thickness -= 0.5;
		return(thickness <= 1);
	}
	
	public void randomize()
	{
		red = Utils.getRand(Byte.MAX_VALUE);
		green = Utils.getRand(Byte.MAX_VALUE);
		blue = Utils.getRand(Byte.MAX_VALUE);
	}
}
